class MessagesGenerator < Rails::Generator::NamedBase
  def manifest
    record do |m|
      # Controller
      m.file "messages_controller.rb", "app/controllers/messages_controller.rb" 
      
      # Helper
      m.file "messages_helper.rb", "app/helpers/messages_helper.rb"
      
      # Model
      m.file "message.rb", "app/models/message.rb"
      m.file "box_item.rb", "app/models/box_item.rb"
            
      # Views
      m.directory "app/views/messages"
      m.file "_inbox_thread.html.erb", "app/views/messages/_inbox_thread.html.erb"
      m.file "_outbox_thread.html.erb", "app/views/messages/_outbox_thread.html.erb"
      m.file "_message.html.erb", "app/views/messages/_message.html.erb"
      m.file "create.rjs", "app/views/messages/create.rjs"
      m.file "inbox.html.erb", "app/views/messages/inbox.html.erb"
      m.file "new.html.erb", "app/views/messages/new.html.erb"
      m.file "outbox.html.erb", "app/views/messages/outbox.html.erb"
      m.file "send_to.html.erb", "app/views/messages/send_to.html.erb"
      m.file "show.html.erb", "app/views/messages/show.html.erb"
      
      # Migration
      m.migration_template 'create_thread_messages.rb', 'db/migrate', :assigns => {
        :migration_name => "CreateThreadMessages"
      }, :migration_file_name => "create_thread_messages"
    end
  end
end